import React, { Component } from 'react'
import{
  Switch,
  Redirect,
  Route
} from 'react-router-dom'
import routes from './routes'
import {Tabbar} from './components'
const tabbarRoutes = routes.filter(route =>route.tittle)   
export default class App extends Component {
  render() {
    return (
      <div>
        <Switch>
          {
            routes.map(route =>{
              return (
                <Route key={route.path} path={route.path} component={route.component} />
              )
            })
          }
          <Redirect exact from='/' to={routes[0].path} />
          <Redirect to='/404' />
        </Switch>
        <div>
          <Tabbar routes={tabbarRoutes} />
        </div>
      </div>
    )
  }
}
